﻿using UnityEngine;
using System.Collections;

public class BulletData {

    private bool _isValid;
    public bool isValid {
        get {
            return _isValid && lifeTimeMax > lifeTimeCurr;
        }
        set {
            _isValid = value;
        }
    }

    public Vector3 position;
    public float speed;
    public Vector3 direction;
    public float lifeTimeMax;
    public float lifeTimeCurr;
    public void Init() {
        position = Vector3.zero;
        speed = 3.0f;
        direction = Vector3.zero;
        lifeTimeMax = 5.0f;
        lifeTimeCurr = 0.0f;
        isValid = false;
    }

    public void Tick() {
        if (isValid == false) return;
        float tickTime = GameScene.instance.gameData.tickTime;
        Vector3 distance = direction * speed * tickTime;
        position += distance;
        lifeTimeCurr += tickTime;
    }
}
